﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Mooc
{
    public partial class updateOpinion : Form
    {
        public updateOpinion(Work work, Opi opi, EduApp eduApp)
        {
            InitializeComponent();
            this.opi = opi;
            this.work = work;
            comment.Text = work.W_comment;
            score.Text = work.W_score;
            content.Text = work.W_content;
            this.eduApp = eduApp;
        }
        EduApp eduApp;

        Work work;

        Opi opi;

        SqlDao sqlDao = new SqlDao(); 

        private void submit_Click(object sender, EventArgs e)
        {
            if (opin.Text == "")
            {
                MessageBox.Show("意见不能为空...");
            }
            else
            {
                opi.O_id = Utils.getTimeTicks();
                opi.W_id = work.W_id;
                opi.O_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                opi.O_comment = opin.Text;
                if (sqlDao.insertOpinion(opi))
                {
                    MessageBox.Show("提交意见成功...");
                    eduApp.delete();
                    this.Close();
                }
            }
        }
    }
}
